import request from '@/utils/request'

// 查询模型软件列表（分页）
export function listSoftwate (query) {
  return request({
    url: '/sources/software/page',
    method: 'get',
    params: query
  })
}

// 通过id查询模型软件
export function getSoftware (id) {
  return request({
    url: '/sources/software/' + id,
    method: 'get'
  })
}

// 删除模型软件
export function delSoftware (softwareId) {
  return request({
    url: '/sources/software/' + softwareId,
    method: 'delete'
  })
}

// 修改模型软件

// 不生成新版本
export function updateSoftwareNotForNew (data) {
  return request({
    url: '/sources/software/notGenNew/update',
    method: 'put',
    data: data
  })
}
//生成新版本
export function updateSoftwareForNew (data) {
  return request({
    url: '/sources/software/GenNew/update',
    method: 'put',
    data: data
  })
}
export function updateSoftware (data) {
  return request({
    url: '/sources/software/update',
    method: 'put',
    data: data
  })
}

// 新增模型软件
export function addSoftware (data) {
  return request({
    url: '/sources/software/add',
    method: 'post',
    data: data
  })
}

// 查询历史部署记录
export function queryHistory (query) {
  return request({
    url: '/sources/skSystemProcess/page',
    method: 'get',
    params: query
  })
}

// 上传 软件
export function devopsUpload (data) {
  return request({
    url: '/sources/skSystem/devopsUpload',
    method: 'post',
    timeout: 6000000,
    data: data
  })
}

//同步成功自动化部署软件记录
export function syncSuccessProcess (data) {
  return request({
    url: '/sources/skSystem/syncSuccessProcess',
    method: 'post',
    data: data
  })
}

export function devopsRunVar (query) {
  return request({
    url: '/sources/skSystem/devopsRunVar',
    method: 'get',
    params: query
  })
}

export function devopsRunInstall (query) {
  return request({
    url: '/sources/skSystem/devopsRunInstall',
    method: 'get',
    params: query
  })
}

export function devopsRunStart (query) {
  return request({
    url: '/sources/skSystem/devopsRunStart',
    method: 'get',
    params: query
  })
}
export function getOsList (query) {
  return request({
    url: '/sources/dictos/getOsList',
    method: 'get',
    params: query
  })
}

export function getRulesBySoftwareId (query) {
  return request({
    url: '/sources/softwareRules/getRulesBySoftwareId',
    method: 'get',
    params: query
  })
}

export function getRulesBySoftwareIdAndVer (query) {
  return request({
    url: '/sources/softwareRules/getRulesBySoftwareIdAndVer',
    method: 'get',
    params: query
  })
}
